package com.yuliang.ai.controller;

import com.yuliang.ai.domain.Dto.AreaDto;
import com.yuliang.ai.domain.Dto.TourCommonDto;
import com.yuliang.ai.domain.Vo.HotelVo;
import com.yuliang.ai.service.HotelService;
import com.yuliang.utils.result.ResultUtils;
import com.yuliang.utils.result.emums.HttpCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * @author Huangkai
 * 酒店相关
 */
@Slf4j
@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    HotelService hotelService;

    @PostMapping(value = "/selectHotelInfo")
    public String selectHotelInfo(@RequestBody HotelVo hotelVo) {
        TourCommonDto hotelListDto = hotelService.selectHotelInfo(hotelVo);
        return ResultUtils.ResultWithMessageDataEnum(HttpCodeEnum.select_success, hotelListDto);
    }

    @GetMapping(value = "/getCityList")
    public String getCityList() {
        List<AreaDto> areaDtoList = hotelService.selectCityList();
        if(areaDtoList != null && areaDtoList.size() >0){
            return ResultUtils.ResultWithMessageDataEnum(HttpCodeEnum.select_success, areaDtoList);
        }
        return ResultUtils.ResultWithMessageEnum(HttpCodeEnum.data_not_exist);
    }

    @GetMapping(value = "/selectHotelPriceStar")
    public String selectHotelPriceStar() {
        return hotelService.selectHotelPriceStar();
    }
}
